package test5;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        List<Student> students = new ArrayList<>();


        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            Score chineseScore = null;
            Score mathScore = null;
            Score physicsScore = null;

            String studentId = "";
            String name = "";
            double RegularGradeAverage=0.00;
            double FinalGradeAverage=0.00;
            for (int j = 0; j < 3; j++) {
                String input = scanner.nextLine().trim();
                String[] parts = input.split(" ");
                studentId = parts[0];
                name = parts[1];
                String subject = parts[2];
                int usualScore = Integer.parseInt(parts[3]);
                int finalScore = Integer.parseInt(parts[4]);

                if ("语文".equals(subject)) {
                    chineseScore = new Score(usualScore, finalScore);
                    RegularGradeAverage+=usualScore;
                    FinalGradeAverage+=finalScore;
                } else if ("数学".equals(subject)) {
                    mathScore = new Score(usualScore, finalScore);
                    RegularGradeAverage+=usualScore;
                    FinalGradeAverage+=finalScore;
                } else if ("物理".equals(subject)) {
                    physicsScore = new Score(usualScore, finalScore);
                    RegularGradeAverage+=usualScore;
                    FinalGradeAverage+=finalScore;
                }
            }
            RegularGradeAverage/=3;
            FinalGradeAverage/=3;
            Student student = new Student(studentId, name, chineseScore, mathScore, physicsScore,RegularGradeAverage,FinalGradeAverage);
            students.add(student);
        }

        for (Student student : students) {
            int totalScore = student.TotalScore();
            double averageScore = student.Average();
            System.out.printf("%s %s %d %.2f %.2f %.2f\n", student.getId(), student.getName(),totalScore,student.getRegularGradeAverage(),student.getFinalGradeAverage(), averageScore);
        }

    }
}
